package com.pig.graduate.domain.sys;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.pig.graduate.domain.BaseEntity;
import lombok.Data;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.authority.SimpleGrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;

import javax.validation.constraints.NotBlank;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Date;
import java.util.List;

/**
 * 
 * @TableName sys_user
 */
@TableName(value ="sys_user")
@Data
public class SysUser extends BaseEntity implements Serializable {

    /**
     * 用户名
     */
    @NotBlank(message = "用户名不能为空！")
    private String username;

    /**
     * 密码
     */
    @NotBlank(message = "密码不能为空！")
    private String password;

    /**
     * 用户头像
     */
    private String avatar;


    /**
     * 手机号码
     */
    private String phoneNumber;

    /**
     * 最后登录时间
     */
    private Date loginDate;

    /**
     * 帐号状态（0正常 1停用）
     */
    private String status;

    /**
     * 昵称
     */
    private String nickName;

    /**
     * 邮箱
     */
    private String email;

    /**
     * 性别
     */
    private String sex;


    /**
     * 所属角色
     */
    @TableField(exist = false)
    private String roles;

    /**
     * 所有角色集合
     */
    @TableField(exist = false)
    private List<SysRole> sysRoleList;

    /**
     * 所有角色集合
     */
    @TableField(exist = false)
    private List<Long> sysRoleIds;


    /**
     * 确认新密码
     */
    @TableField(exist = false)
    private String newPassword;

    /**
     * 旧密码
     */
    @TableField(exist = false)
    private String oldPassword;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

}